package com.matt.foundation.vo;

import com.matt.domain.LiveRoom;
import com.matt.domain.TeachingArea;
import lombok.Data;

import java.util.List;
import java.util.stream.Collectors;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/9/6
 * *******************************
 */
@Data
public class TeachingAreaVo {
    private String id;
    private String name;
    private String remark;

    private Boolean isPublic;

    private List<String> cameraIds;

    public static TeachingAreaVo of(TeachingArea teachingArea, List<LiveRoom> cameras){
        TeachingAreaVo vo = new TeachingAreaVo();
        vo.setId(teachingArea.getId());
        vo.setName(teachingArea.getName());
        vo.setRemark(teachingArea.getRemark());
        vo.setIsPublic(teachingArea.getIsPublic());

        vo.setCameraIds(cameras.stream().map(o->o.getId()).collect(Collectors.toList()));
        return vo;
    }
}
